import { defHttp } from '/@/utils/http/axios';
import { ContentTypeEnum } from '/@/enums/httpEnum';

enum Api {
  getdictDataList = '/admin-api/system/dict-type/page',
  getdictData = '/admin-api/system/dict-type/get',
  getdictDataAdd = '/admin-api/system/dict-type/create',
  getdictDataEdit = '/admin-api/system/dict-type/update',
  getdictDataDelete = '/admin-api/system/dict-type/delete',
  getdictList = '/admin-api/system/dict-data/page',
  getdict = '/admin-api/system/dict-data/get',
  getdictAdd = '/admin-api/system/dict-data/create',
  getdictEdit = '/admin-api/system/dict-data/update',
  getdictDelete = '/admin-api/system/dict-data/delete',
}

/**
 * @description: 获字典
 */
export const dictDataList = (params: any) => {
  return defHttp.get<any>({ url: Api.getdictDataList, params });
};
export const getdictData = (params: any) => {
  return defHttp.get<any>({ url: Api.getdictData, params });
};
export const adddictData = (params: any) => {
  return defHttp.post<any>({ url: Api.getdictDataAdd, params });
};
export const editdictData = (params: any) => {
  return defHttp.put<any>({ url: Api.getdictDataEdit, params });
};
export const deletedictData = (params: any) => {
  return defHttp.delete<any>({
    url: Api.getdictDataDelete,
    params,
    headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
  });
};
export const dictList = (params: any) => {
  return defHttp.get<any>({ url: Api.getdictList, params });
};
export const getdict = (params: any) => {
  return defHttp.get<any>({ url: Api.getdict, params });
};
export const adddict = (params: any) => {
  return defHttp.post<any>({ url: Api.getdictAdd, params });
};
export const editdict = (params: any) => {
  return defHttp.put<any>({ url: Api.getdictEdit, params });
};
export const deletedict = (params: any) => {
  return defHttp.delete<any>({
    url: Api.getdictDelete,
    params,
    headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
  });
};
